package com.kaishengit.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.kaishengit.pojo.Project;
import com.kaishengit.pojo.User;
import com.kaishengit.pojo.Userproject;

@Repository
@SuppressWarnings("unchecked")
public class UserprojectDao extends BaseDao<Userproject,Integer>{
	
	public List<Userproject> findByProjectId(Project project) {
		String hql = "from Userproject where project = :project";
		Query query = getSession().createQuery(hql);
		query.setParameter("project",project);
		return query.list();
	}

	public List<Userproject> findByUser(User user) {
		String hql = "from Userproject where user = :user";
		Query query = getSession().createQuery(hql);
		query.setParameter("user",user);
		return query.list();
	}

}
